<template>
  <div class="business-satisfaction-service-container">
    <vab-query-form>
      <!-- <vab-query-form-left-panel :span="12">
        <el-button :icon="Plus" type="primary" @click="moreSearch">
          高级查询
        </el-button>
      </vab-query-form-left-panel> -->
      <vab-query-form-left-panel :span="24">
        <el-form :inline="true" :model="queryForm" @submit.prevent>
          <el-space :size="5">
            <el-form-item>
              <el-select
                v-model="queryForm.AreaCity"
                placeholder="按客户区域"
                clearable
                style="width: 120px"
              >
                <el-option label="全部" value="100000" />
                <el-option
                  v-for="(item, index) in OpenAreaCity"
                  :key="index"
                  :label="item.AreaName"
                  :value="item.CityCode"
                />
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-cascader
                v-model="queryForm.searchCompany"
                :options="CompanyOptions"
                :props="companyProps"
                clearable
                placeholder="按组织"
                style="width: 160px"
                @change="getDeptment"
              />
            </el-form-item>
            <el-form-item>
              <el-cascader
                v-model="queryForm.searchDeptment"
                :options="DeptmentOptions"
                :props="deptmentProps"
                clearable
                collapse-tags
                placeholder="按部门"
                style="width: 160px"
              />
            </el-form-item>
            <el-form-item>
              <el-input
                v-model.trim="queryForm.searchSignOrder"
                clearable
                placeholder="搜签单人"
                style="width: 100px"
              />
            </el-form-item>
            <el-form-item>
              <el-select
                v-model="queryForm.KefuStaffID"
                multiple
                collapse-tags
                style="width: 160px"
              >
                <el-option label="全部客满" :value="0" />
                <el-option
                  v-for="(item, index) in KefuOptions"
                  :key="index"
                  :label="item.StaffName"
                  :value="item.StaffID"
                />
              </el-select>
              <!-- <el-cascader
                v-model="queryForm.searchCompany"
                :options="KefuOptions"
                :props="KefuOptionProps"
                clearable
                placeholder="按客满"
                style="width: 100px"
              /> -->
            </el-form-item>
            <!-- <el-form-item v-if="queryForm.KefuStaffID===[0]">
              <el-input
                v-model.trim="queryForm.searchKefu"
                clearable
                placeholder="搜客满"
                style="width: 100px"
              />
            </el-form-item> -->
            <el-form-item>
              <el-input
                v-model.trim="queryForm.searchOperater"
                clearable
                placeholder="搜运营师"
                style="width: 100px"
              />
            </el-form-item>
            <el-form-item>
              <el-select
                v-model="queryForm.orderType"
                clearable
                placeholder="按合同属性"
                style="width: 120px"
              >
                <el-option
                  v-for="(item, index) in OrderTypeOption"
                  :key="index"
                  :label="item.OrderTypeName"
                  :value="item.OrderTypeID"
                />
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-input
                v-model.trim="queryForm.searchKey"
                clearable
                placeholder="按客户名称"
              />
            </el-form-item>
            <!-- <el-form-item>
              <el-select
                v-model="queryForm.isRecord"
                clearable
                placeholder="按是否有小记"
                style="width: 160px"
              >
                <el-option label="全部" :value="0" />
                <el-option label="有小记" :value="1" />
                <el-option label="无小记" :value="-1" />
              </el-select>
            </el-form-item> -->
            <el-form-item>
              <el-date-picker
                v-model="queryForm.ServiceStartDate"
                style="width: 240px"
                type="daterange"
                placeholder="按服务起始日期"
                start-placeholder="服务起始日期"
                end-placeholder="服务起始日期"
                value-format="YYYY-MM-DD"
              />
            </el-form-item>
            <el-form-item>
              <el-button :icon="Search" type="primary" @click="queryData">
                查询
              </el-button>
            </el-form-item>
          </el-space>
        </el-form>
      </vab-query-form-left-panel>
    </vab-query-form>

    <el-tabs
      v-model="queryForm.tab"
      type="border-card"
      @tab-click="handleTabClick"
    >
      <el-tab-pane label="我负责的" name="my">
        <el-table
          v-loading="listLoading"
          :data="list"
          @selection-change="setSelectRows"
        >
          <!-- <el-table-column
            align="center"
            show-overflow-tooltip
            type="selection"
          /> -->
          <el-table-column
            align="center"
            label="客户ID"
            prop="CustomerID"
            show-overflow-tooltip
            width="70"
          />
          <el-table-column
            align="center"
            label="客满专员"
            prop="KefuStaffName"
            show-overflow-tooltip
            width="100"
          />
          <el-table-column
            align="left"
            label="客户全称"
            prop="CustomerAllName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="所在地区"
            prop="CityShow"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="所属行业"
            prop="IndustryShow"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="地址"
            prop="Address"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="电话"
            prop="Telphone"
            show-overflow-tooltip
          />
          <el-table-column align="center" label="客户标记" width="100">
            <template #default="{ row }">
              <el-tag v-for="(itm, idx) in row.CustomerMarks" :key="idx">
                {{ itm }}
              </el-tag>
            </template>
          </el-table-column>
          <!-- <el-table-column align="center" label="信息维护" width="100">
            <template #default="{ row }">
              <el-button text @click="showCustomer(row)">编辑</el-button>
            </template>
          </el-table-column>
          <el-table-column align="center" label="证照维护" width="100">
            <template #default="{ row }">
              <el-button text @click="licenseEdit(row)">编辑</el-button>
            </template>
          </el-table-column> -->
        </el-table>
        <el-pagination
          background
          :current-page="queryForm.pageNo"
          :layout="layout"
          :page-size="queryForm.pageSize"
          :total="total"
          @current-change="handleCurrentChange"
          @size-change="handleSizeChange"
        />
      </el-tab-pane>
      <!-- <el-tab-pane label="我曾负责的" name="history">
        <el-table
          v-loading="listLoading"
          :data="list"
          @selection-change="setSelectRows"
        >
          <el-table-column
            align="center"
            show-overflow-tooltip
            type="selection"
          />
          <el-table-column
            align="center"
            label="客户ID"
            prop="CustomerID"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="客户全称"
            prop="CustomerAllName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="所在地区"
            prop="CityShow"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="所属行业"
            prop="IndustryShow"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="地址"
            prop="Address"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="电话"
            prop="Telphone"
            show-overflow-tooltip
          />
          <el-table-column align="center" label="客户标记" width="100">
            <template #default="{ row }">
              <el-tag v-for="(itm, idx) in row.CustomerMarks" :key="idx">
                {{ itm }}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column align="center" label="操作" width="200">
            <template #default="{ row }">
              <el-button type="primary" @click="showCustomer(row)">
                查看详情
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          background
          :current-page="queryForm.pageNo"
          :layout="layout"
          :page-size="queryForm.pageSize"
          :total="total"
          @current-change="handleCurrentChange"
          @size-change="handleSizeChange"
        />
      </el-tab-pane> -->
      <el-tab-pane label="新到单待提单" name="newCreate">
        <el-table
          v-loading="listLoading"
          :data="list"
          @selection-change="setSelectRows"
        >
          <el-table-column
            align="center"
            label="合同ID"
            prop="OrderID"
            show-overflow-tooltip
            style="width: 80px"
          />
          <el-table-column
            align="center"
            label="到单时间"
            prop="createTime"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="客户名称"
            prop="CustomerAllName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="合同属性"
            prop="OrderType"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="业务类别"
            prop="BusinessOrderName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="订单号"
            prop="OrderCode"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="签单人"
            prop="SaleStaffName"
            show-overflow-tooltip
          />
          <el-table-column align="center" label="操作" width="200">
            <template #default="{ row }">
              <el-button type="primary" @click="showOrder(row)">
                查看详情
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          background
          :current-page="queryForm.pageNo"
          :layout="layout"
          :page-size="queryForm.pageSize"
          :total="total"
          @current-change="handleCurrentChange"
          @size-change="handleSizeChange"
        />
      </el-tab-pane>
      <el-tab-pane label="新提单待审核分单" name="newSubmit">
        <el-table
          v-loading="listLoading"
          :data="list"
          @selection-change="setSelectRows"
        >
          <el-table-column
            align="center"
            label="合同ID"
            prop="OrderID"
            show-overflow-tooltip
            style="width: 80px"
          />
          <el-table-column
            align="center"
            label="提单时间"
            prop="submitOrderTime"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="客户名称"
            prop="CustomerAllName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="合同属性"
            prop="OrderType"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="业务类别"
            prop="BusinessOrderName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="订单号"
            prop="OrderCode"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="签单人"
            prop="SaleStaffName"
            show-overflow-tooltip
          />
          <el-table-column align="center" label="操作" width="200">
            <template #default="{ row }">
              <el-button type="primary" @click="showOrder(row)">
                查看详情
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          background
          :current-page="queryForm.pageNo"
          :layout="layout"
          :page-size="queryForm.pageSize"
          :total="total"
          @current-change="handleCurrentChange"
          @size-change="handleSizeChange"
        />
      </el-tab-pane>
      <el-tab-pane label="已分单待复核" name="newReview">
        <el-table
          v-loading="listLoading"
          :data="list"
          @selection-change="setSelectRows"
        >
          <el-table-column
            align="center"
            label="合同ID"
            prop="OrderID"
            show-overflow-tooltip
            style="width: 80px"
          />
          <el-table-column
            align="center"
            label="审单时间"
            prop="reviewTime"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="客户名称"
            prop="CustomerAllName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="合同属性"
            prop="OrderType"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="业务类别"
            prop="BusinessOrderName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="订单号"
            prop="OrderCode"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="签单人"
            prop="SaleStaffName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="审核分单人"
            prop="ReviewStaff"
            show-overflow-tooltip
          />
          <el-table-column align="center" label="操作" width="200">
            <template #default="{ row }">
              <el-button type="primary" @click="showOrder(row)">
                查看详情
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          background
          :current-page="queryForm.pageNo"
          :layout="layout"
          :page-size="queryForm.pageSize"
          :total="total"
          @current-change="handleCurrentChange"
          @size-change="handleSizeChange"
        />
      </el-tab-pane>
      <el-tab-pane label="已复核并分单" name="newAssign">
        <el-table
          v-loading="listLoading"
          :data="list"
          @selection-change="setSelectRows"
        >
          <el-table-column
            align="center"
            label="合同ID"
            prop="OrderID"
            show-overflow-tooltip
            style="width: 80px"
          />
          <el-table-column
            align="center"
            label="复核时间"
            prop="assignTime"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="客户名称"
            prop="CustomerAllName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="合同属性"
            prop="OrderType"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="业务类别"
            prop="BusinessOrderName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="订单号"
            prop="OrderCode"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="签单人"
            prop="SaleStaffName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="接单人"
            prop="TaskStaff"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="客满专员"
            prop="KefuStaffName"
            show-overflow-tooltip
          />
          <el-table-column align="center" label="操作" width="100">
            <template #default="{ row }">
              <el-button type="primary" @click="showOrder(row)">
                查看详情
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          background
          :current-page="queryForm.pageNo"
          :layout="layout"
          :page-size="queryForm.pageSize"
          :total="total"
          @current-change="handleCurrentChange"
          @size-change="handleSizeChange"
        />
      </el-tab-pane>
      <el-tab-pane label="新分待运营任务" name="newOperate">
        <el-table
          v-loading="listLoading"
          :data="list"
          @selection-change="setSelectRows"
        >
          <!-- <el-table-column
            align="center"
            show-overflow-tooltip
            type="selection"
          /> -->
          <el-table-column
            align="center"
            label="合同ID"
            prop="BusinessOrderID"
            show-overflow-tooltip
            width="80"
          />
          <el-table-column
            align="center"
            label="客户名称"
            prop="CustomerAllName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="合同编号"
            prop="OrderCode"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="合同属性"
            prop="OrderType"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="签单人"
            prop="SaleStaffName"
            show-overflow-tooltip
            width="100"
          />
          <el-table-column
            align="center"
            label="客满专员"
            prop="KefuStaffName"
            show-overflow-tooltip
            width="100"
          />
          <el-table-column
            align="center"
            label="派单人"
            prop="AssignStaffName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="接单人"
            prop="TaskStaff"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="业务类别"
            prop="BusinessOrderName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="业务产品"
            prop="ProductName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="服务对象"
            prop="BindStoreAccount"
            show-overflow-tooltip
          />
          <el-table-column align="center" label="操作" width="200">
            <template #default="{ row }">
              <el-button type="primary" @click="showWorkTask(row)">
                查看详情
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          background
          :current-page="queryForm.pageNo"
          :layout="layout"
          :page-size="queryForm.pageSize"
          :total="total"
          @current-change="handleCurrentChange"
          @size-change="handleSizeChange"
        />
      </el-tab-pane>
      <el-tab-pane label="接单待服务" name="waitService">
        <el-table
          v-loading="listLoading"
          :data="list"
          @selection-change="setSelectRows"
        >
          <!-- <el-table-column
            align="center"
            show-overflow-tooltip
            type="selection"
          /> -->
          <el-table-column
            align="center"
            label="合同ID"
            prop="BusinessOrderID"
            show-overflow-tooltip
            width="100"
          />
          <el-table-column
            align="center"
            label="客户名称"
            prop="CustomerAllName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="合同编号"
            prop="OrderCode"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="合同属性"
            prop="OrderType"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="签单人"
            prop="SaleStaffName"
            show-overflow-tooltip
          />
          <!-- <el-table-column
            align="center"
            label="派单人"
            prop="AssignStaffName"
            show-overflow-tooltip
            width="100"
          /> -->
          <el-table-column
            align="center"
            label="客满专员"
            prop="KefuStaffName"
            show-overflow-tooltip
            width="100"
          />
          <el-table-column
            align="center"
            label="接单人"
            prop="TaskStaff"
            show-overflow-tooltip
            width="100"
          />
          <el-table-column
            align="center"
            label="运营师"
            prop="Operater"
            show-overflow-tooltip
            width="100"
          />
          <el-table-column
            align="center"
            label="业务类别"
            prop="BusinessOrderName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="业务产品"
            prop="ProductName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="服务对象"
            prop="BindStoreAccount"
            show-overflow-tooltip
          />
          <el-table-column align="center" label="服务周期" width="220">
            <template #default="{ row }">
              <span>{{ row.ServiceStartDate }}至{{ row.ServiceEndDate }}</span>
              <br />
              <span style="font-size: 12px; color: #999">
                {{ row.SetServiceTime }}
              </span>
            </template>
          </el-table-column>
          <el-table-column align="center" label="操作" width="100">
            <template #default="{ row }">
              <el-button type="primary" @click="showWorkTask(row)">
                查看详情
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          background
          :current-page="queryForm.pageNo"
          :layout="layout"
          :page-size="queryForm.pageSize"
          :total="total"
          @current-change="handleCurrentChange"
          @size-change="handleSizeChange"
        />
      </el-tab-pane>
      <el-tab-pane label="运营服务中" name="serviceing">
        <el-table
          v-loading="listLoading"
          :data="list"
          @selection-change="setSelectRows"
        >
          <!-- <el-table-column
            align="center"
            show-overflow-tooltip
            type="selection"
          /> -->
          <el-table-column
            align="center"
            label="合同ID"
            prop="BusinessOrderID"
            show-overflow-tooltip
            width="100"
          />
          <el-table-column
            align="center"
            label="客户名称"
            prop="CustomerAllName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="合同编号"
            prop="OrderCode"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="合同属性"
            prop="OrderType"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="签单人"
            prop="SaleStaffName"
            show-overflow-tooltip
            width="100"
          />
          <!-- <el-table-column
            align="center"
            label="派单人"
            prop="AssignStaffName"
            show-overflow-tooltip
            width="100"
          /> -->
          <el-table-column
            align="center"
            label="客满专员"
            prop="KefuStaffName"
            show-overflow-tooltip
            width="100"
          />
          <el-table-column
            align="center"
            label="接单人"
            prop="TaskStaff"
            show-overflow-tooltip
            width="100"
          />
          <el-table-column
            align="center"
            label="运营师"
            prop="Operater"
            show-overflow-tooltip
            width="100"
          />
          <el-table-column
            align="center"
            label="业务类别"
            prop="BusinessOrderName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="业务产品"
            prop="ProductName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="服务对象"
            prop="BindStoreAccount"
            show-overflow-tooltip
          />
          <el-table-column align="center" label="服务周期" width="220">
            <template #default="{ row }">
              <span>{{ row.ServiceStartDate }}至{{ row.ServiceEndDate }}</span>
              <br />
              <span style="font-size: 12px; color: #999">
                {{ row.SetServiceTime }}
              </span>
            </template>
          </el-table-column>
          <el-table-column align="center" label="操作" width="100">
            <template #default="{ row }">
              <el-button type="primary" @click="showWorkTask(row)">
                查看详情
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          background
          :current-page="queryForm.pageNo"
          :layout="layout"
          :page-size="queryForm.pageSize"
          :total="total"
          @current-change="handleCurrentChange"
          @size-change="handleSizeChange"
        />
      </el-tab-pane>
      <el-tab-pane label="运营暂停中" name="paused">
        <el-table
          v-loading="listLoading"
          :data="list"
          @selection-change="setSelectRows"
        >
          <!-- <el-table-column
            align="center"
            show-overflow-tooltip
            type="selection"
          /> -->
          <el-table-column
            align="center"
            label="合同ID"
            prop="BusinessOrderID"
            show-overflow-tooltip
            width="100"
          />
          <el-table-column
            align="center"
            label="客户名称"
            prop="CustomerAllName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="合同编号"
            prop="OrderCode"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="合同属性"
            prop="OrderType"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="签单人"
            prop="SaleStaffName"
            show-overflow-tooltip
            width="100"
          />
          <!-- <el-table-column
            align="center"
            label="派单人"
            prop="AssignStaffName"
            show-overflow-tooltip
            width="100"
          /> -->
          <el-table-column
            align="center"
            label="客满专员"
            prop="KefuStaffName"
            show-overflow-tooltip
            width="100"
          />
          <el-table-column
            align="center"
            label="接单人"
            prop="TaskStaff"
            show-overflow-tooltip
            width="100"
          />
          <el-table-column
            align="center"
            label="运营师"
            prop="Operater"
            show-overflow-tooltip
            width="100"
          />
          <el-table-column
            align="center"
            label="业务类别"
            prop="BusinessOrderName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="业务产品"
            prop="ProductName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="服务对象"
            prop="BindStoreAccount"
            show-overflow-tooltip
          />
          <el-table-column align="center" label="服务周期" width="220">
            <template #default="{ row }">
              {{ row.ServiceStartDate }}至{{ row.ServiceEndDate }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="操作" width="100">
            <template #default="{ row }">
              <el-button type="primary" @click="showWorkTask(row)">
                查看详情
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          background
          :current-page="queryForm.pageNo"
          :layout="layout"
          :page-size="queryForm.pageSize"
          :total="total"
          @current-change="handleCurrentChange"
          @size-change="handleSizeChange"
        />
      </el-tab-pane>
      <el-tab-pane label="已终止服务" name="serviceEnd">
        <el-table
          v-loading="listLoading"
          :data="list"
          @selection-change="setSelectRows"
        >
          <!-- <el-table-column
            align="center"
            show-overflow-tooltip
            type="selection"
          /> -->
          <el-table-column
            align="center"
            label="合同ID"
            prop="BusinessOrderID"
            show-overflow-tooltip
            width="100"
          />
          <el-table-column
            align="center"
            label="客户名称"
            prop="CustomerAllName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="合同编号"
            prop="OrderCode"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="合同属性"
            prop="OrderType"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="签单人"
            prop="SaleStaffName"
            show-overflow-tooltip
            width="100"
          />
          <!-- <el-table-column
            align="center"
            label="派单人"
            prop="AssignStaffName"
            show-overflow-tooltip
            width="100"
          /> -->
          <el-table-column
            align="center"
            label="客满专员"
            prop="KefuStaffName"
            show-overflow-tooltip
            width="100"
          />
          <el-table-column
            align="center"
            label="接单人"
            prop="TaskStaff"
            show-overflow-tooltip
            width="100"
          />
          <el-table-column
            align="center"
            label="运营师"
            prop="Operater"
            show-overflow-tooltip
            width="100"
          />
          <el-table-column
            align="center"
            label="业务类别"
            prop="BusinessOrderName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="业务产品"
            prop="ProductName"
            show-overflow-tooltip
          />
          <el-table-column
            align="center"
            label="服务对象"
            prop="BindStoreAccount"
            show-overflow-tooltip
          />
          <el-table-column align="center" label="服务周期" width="220">
            <template #default="{ row }">
              {{ row.ServiceStartDate }}至{{ row.ServiceEndDate }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="操作" width="100">
            <template #default="{ row }">
              <el-button type="primary" @click="showWorkTask(row)">
                查看详情
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          background
          :current-page="queryForm.pageNo"
          :layout="layout"
          :page-size="queryForm.pageSize"
          :total="total"
          @current-change="handleCurrentChange"
          @size-change="handleSizeChange"
        />
      </el-tab-pane>
    </el-tabs>
    <customer-edit ref="editRef" @fetch-data="fetchData" />
    <more-search ref="searchRef" @fetch-data="fetchData" />
    <license-msg ref="LicenseMsgRef" @fetch-data="fetchData" />
  </div>
</template>

<script>
  import {
    getOpenAreaCity,
    getCompanySelect,
    OperateDeptmentSelect,
    getBusinessClassSelect,
    getKefuOptions,
  } from '@/api/common'
  import { getKefuServiceList } from '@/api/business'
  // import DateSelect from '/src/components/DateSelect.vue'
  import CustomerEdit from '@/views/components/CustomerDataeditEdit'
  import LicenseMsg from '@/views/components/LicenseMsg'
  import MoreSearch from './components/BusinessSatisfactionServiceSearch'

  import { Delete, Plus, Search } from '@element-plus/icons-vue'

  export default defineComponent({
    name: 'SatisfactionService',
    components: { CustomerEdit, LicenseMsg, MoreSearch },
    setup() {
      const $baseConfirm = inject('$baseConfirm')
      const $baseMessage = inject('$baseMessage')
      const router = useRouter()

      const state = reactive({
        KefuOptions: [],
        searchRef: null,
        LicenseMsgRef: null,
        editRef: null,
        list: [],
        listLoading: true,
        layout: 'total, sizes, prev, pager, next, jumper',
        total: 0,
        selectRows: '',
        queryForm: {
          pageNo: 1,
          pageSize: 10,
          tab: 'my',
          KefuStaffID: [],
        },
        BusinessClassOptions: [],
        OrderTypeOption: [],
        OpenAreaCity: [],
        CompanyOptions: [],
        KefuOptionProps: {
          multiple: true,
          expandTrigger: 'hover',
        },
        companyProps: {
          multiple: true,
          // checkStrictly: true,
          expandTrigger: 'hover',
        },
        DeptmentOptions: [],
        deptmentProps: {
          multiple: true,
          // checkStrictly: true,
          expandTrigger: 'hover',
        },
      })
      const getKefuOption = async () => {
        const {
          data: { StaffOptions },
        } = await getKefuOptions()
        state.KefuOptions = StaffOptions
      }
      const setSelectRows = (val) => {
        state.selectRows = val
      }
      const moreSearch = (row) => {
        if (row.id) {
          state.searchRef.showEdit(row)
        } else {
          state.searchRef.showEdit()
        }
      }
      const handleDelete = (row) => {
        if (row.id) {
          $baseConfirm('你确定要删除当前项吗', null, async () => {
            const { msg } = await doDelete({ ids: row.id })
            $baseMessage(msg, 'success', 'vab-hey-message-success')
            await fetchData()
          })
        } else {
          if (state.selectRows.length > 0) {
            const ids = state.selectRows.map((item) => item.id).join()
            $baseConfirm('你确定要删除选中项吗', null, async () => {
              const { msg } = await doDelete({ ids })
              $baseMessage(msg, 'success', 'vab-hey-message-success')
              await fetchData()
            })
          } else {
            $baseMessage('未选中任何行', 'error', 'vab-hey-message-error')
          }
        }
      }
      const getDate = (data) => {
        state.queryForm.ServiceDates = data
        console.log(data, '子组件传过来的时间数组1')
      }
      const handleSizeChange = (val) => {
        state.queryForm.pageSize = val
        fetchData()
      }
      const handleCurrentChange = (val) => {
        state.queryForm.pageNo = val
        fetchData()
      }
      const queryData = () => {
        state.queryForm.pageNo = 1
        fetchData()
      }
      const handleTabClick = (tab) => {
        console.log(tab.props.name)
        state.queryForm.tab = tab.props.name
        fetchData()
      }
      // 选择组织后
      const getDeptment = async () => {
        console.log('form.Company', state.queryForm.searchCompany)
        if (state.queryForm.searchCompany) {
          const getParams = {
            CompanyID: state.queryForm.searchCompany,
          }
          const {
            data: { DeptmentOptions },
          } = await OperateDeptmentSelect(getParams)
          state.DeptmentOptions = DeptmentOptions
        } else {
          state.queryForm.searchDeptment = []
          state.DeptmentOptions = []
        }
      }
      const fetchData = async () => {
        state.listLoading = true
        getKefuOption()
        const {
          data: { BusinessClassOptions, OrderTypeOption },
        } = await getBusinessClassSelect()
        state.BusinessClassOptions = BusinessClassOptions
        state.OrderTypeOption = OrderTypeOption
        const { data } = await getOpenAreaCity()
        state.OpenAreaCity = data
        const {
          data: { CompanyOptions },
        } = await getCompanySelect()
        state.CompanyOptions = CompanyOptions
        const {
          data: { list, total, KefuStaffID },
        } = await getKefuServiceList(state.queryForm)
        state.queryForm.KefuStaffID = KefuStaffID
        state.list = list
        state.total = total
        state.listLoading = false
      }
      onMounted(() => {
        fetchData()
      })

      const showCustomer = (row) => {
        if (row.CustomerID) {
          state.editRef.showEdit(row)
        } else {
          state.editRef.showEdit()
        }
      }

      const licenseEdit = (row) => {
        state.LicenseMsgRef.showEdit(row)
        console.log(row, '证照维护')
      }

      const showOrder = (row) => {
        router.push({
          path: 'satisfactionOrder',
          query: {
            orderid: row.OrderID,
          },
        })
      }

      const showWorkTask = (row) => {
        const userInfo = JSON.parse(localStorage.getItem('userInfo'))
        const actstaffpost = JSON.parse(userInfo.StaffPostID)
        const actstaffpostid = actstaffpost[0][1]
        router.push({
          path: 'satisfactionOperate',
          query: {
            actstaffpostid: actstaffpostid,
            OrderID: row.BusinessOrderID,
            WorkTaskID: row.WorkTaskID,
          },
        })
      }

      return {
        ...toRefs(state),
        getKefuOption,
        setSelectRows,
        moreSearch,
        handleDelete,
        handleSizeChange,
        handleCurrentChange,
        queryData,
        handleTabClick,
        fetchData,
        showOrder,
        showWorkTask,
        showCustomer,
        licenseEdit,
        getDeptment,
        getDate,
        Delete,
        Plus,
        Search,
      }
    },
  })
</script>
